#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int check_key(int arr[], int key, int left, int right)
{
	if (key == arr[(left + right) / 2])
	{
		return (left + right) / 2;
	}
	if (left >= right)
	{
		return -1;
	}
	if (key > arr[(left + right) / 2])
	{
		check_key(arr, key, (left + right) / 2 + 1, right);
	}
	else
	{
		check_key(arr, key, left, (left + right) / 2 - 1);
	}
}

int main()
{
	int arr[10] = { 1,2,3,4,5,6,7,8,9 };
	int ret = check_key(arr, 5, 0, 8);
	if(ret==-1)
	{
		printf("no\n");
	}
	else
	{
		printf("%d\n", arr[ret]);
	}
	return 0;
}